/*
 * Google code Testing
 */
package bob.project.deitel.c233;

import java.util.Scanner;

public class BMI {

	//variable for BMI calculation
	private double bmi = 0;
	private double pound = 0;
	private double kilo = 0;
	private double inch = 0;
	private double meter = 0;
	
	//User input 
	Scanner input = new Scanner(System.in);
	
	/* Question Why this does not work */
	//double inputValue = input.nextDouble();
	//int decisionValue = input.nextInt();
	
	/*	Methods	 */
	
	//calculate with pounds with inches
	public void calPound(){
		System.out.println("Please enter your weight in Pounds:");
		pound = input.nextDouble();
		
		System.out.println("Please enter your height in Inches:");
		inch = input.nextDouble();
		
		System.out.println("You BMI index value is : " + bmi);
		bmi = ( pound * 703 ) / inch * inch; 
		bmiValues();
	}
	
	//calculate with kilograms with meters
	public void calKilo() {
		System.out.println("Please enter your weight in Kilograms:");
		kilo = input.nextDouble();
		
		System.out.println("Please enter your height in Meters:");
		meter = input.nextDouble();
		
		System.out.println("You BMI index value is : " + bmi);
		bmi = kilo / meter * meter; 
		bmiValues();
	}
	
	//BMI value analysis with health result
	public void bmiValues() {

		if (bmi < 18.5) {
			System.out.println("You are Underweight!");
		} else if ( bmi > 18.5 && bmi < 24.9 ) {
			System.out.println("You are Normal!");
		} else if ( bmi > 25 && bmi <29.9 ) {
			System.out.println("You are Overweight!");
		} else {
			System.out.println("You are Obese!");
		}
	}
	
	
	//Message display with calculation option choose
	public void displayMessage() {
		
		System.out.println("Welcome to BMI index calculator \n");
		System.out.println("Please Choose calculation method: \n"+
		" (Press 1 for Pound/Inches " + " Press 2 for Kilogram/Meters) ");
		
		switch (input.nextInt()) {
		case 1:
			calPound();
			break;
		case 2:
			calKilo();
			break;
		default:
			System.out.println("Error! Invalid Input number! Please Press 1 or 2 from keyboard.");
			break;
		}
		
	}
	
}
